using System;
using System.Web.UI;

namespace Sedna.Core.Controller.Configurations
{
    /// <summary>
    /// Summary description for StringCutDataGridColumnDataTranslator.
    /// </summary>
    public class AbsNumberDataTranslator : IDataTranslator
    {
        private string format = "{0:0.00##}";

        public string Format
        {
            get { return format; }
            set { format = value; }
        }

        public object Translate(Control control, object value)
        {
            return Translate(control, value, null);
        }

        public object Translate(Control control, object value, Type targetType)
        {
            decimal res = Convert.ToDecimal(value);
            return String.Format(format, Math.Abs(res));
        }
    }
}